package jm.coll.set;

import java.util.Comparator;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * @Description TreeSet源码
 * @date 2022/4/4 16:25
 */
public class TreeSetSource {
    public static void main(String[] args) {
        String a = "A";
        TreeSet<String > set = new TreeSet<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                // 让字符串进行比较
                return o2.length() - o1.length();
            }
        });
        set.add("a");
        set.add("c");
        set.add("sdfsd");
        System.out.println(set);
    }




}
